﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="query.aspx.cs" Inherits="AnyOffice.general.notify.manage.query" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>公告通知查询</title>
		
		<link rel="stylesheet" type="text/css" href="/module/date_selector/popcalendar.css">
			<script src="/module/date_selector/popcalendar.js"></script>
			<script src="/aspnet_client/core/function.js"></script>
			<script Language="JavaScript">
			function CheckForm()
			{
			if(!checkIsDate(document.Form1.txtSendTimeMIN.value))
			{
				alert("开始日期不正确！");
				document.Form1.txtSendTimeMIN.focus();
				return (false);
			}
			   
			if(!checkIsDate(document.Form1.txtSendTimeMAX.value))
			{
				alert("结束日期不正确！");
				document.Form1.txtSendTimeMAX.focus();
				return (false);
			}
			return (true);
			}

			function open_notify(notify_id)
			{
//				URL="read_notify.aspx?notify_id="+notify_id;
//				myleft=(screen.availWidth-500)/2;
//				window.open(URL,"read_notify","height=400,width=550,status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,top=150,left="+myleft+",resizable=yes");
//			
            
            var mwidth = "600";
				var mheight = "450";
				var loc_x = parseInt((window.screen.width - mwidth) / 2);
				var loc_y = parseInt((window.screen.height - mwidth) / 2);

				var _oParameter = new Object();
				_oParameter.dialogTitle = "文件管理";
				_oParameter.openFile = "read_notify.aspx?notify_id="+notify_id+ "&num=" + Math.random();

				window.showModalDialog('shDialog.htm', _oParameter, 'dialogHeight:' + mheight + 'px;dialogWidth:' + mwidth + 'px;dialogLeft:' + loc_x + ';dialogTop:' + loc_y + ';help:no;status:no;scroll:yes;titlebar:no;toolbar:no');
            
            
            
            
            }

 function delete_notify(notify_id,page)
{
	msg='确认要删除该项公告通知么？';
	if(window.confirm(msg))
	{
		URL="delete.aspx?notify_id="+notify_id+"&type_id=<%=ViewState["TypeId"]%>&page="+page;
		window.location=URL;
	}
}

 function no_important(notify_id,page)
{
	msg='确认要取消置顶么？';
	if(window.confirm(msg))
	{
		URL="no_important.aspx?notify_id="+notify_id+"&type_id=<%=ViewState["TypeId"]%>&page="+page;
		window.location=URL;	}
}

function change_type(type_id)
{
 window.location="index1.aspx?type_id="+type_id;
}

function show_reader(notify_id)
{
  URL="show_reader.aspx?notify_id="+notify_id;
  myleft=(screen.availWidth-500)/2;
  window.open(URL,"show_reader","height=500,width=700,status=0,toolbar=no,menubar=no,location=no,scrollbars=yes,top=150,left="+myleft+",resizable=yes");
}                                              
		</script>

	</HEAD>
	<body class="bodycolor" style="padding-top:0;" topmargin="5">
		<form id="Form1" method="post" runat="server">
         <div class="main_div">
			<table border="0" width="90%" cellspacing="0" cellpadding="3" class="small">
				<tr>
					<td class="tab_ti"><span class="big3">
							<asp:Literal id="litNavTitle" runat="server"></asp:Literal>
						</span>
					</td>
				</tr>
			</table>
			<br>
			<asp:Panel id="pnlMain" runat="server">
				<TABLE width="500" cellSpacing="0" cellPadding="0" border="0" class="tab_pub" align="center">
					<TR>
						<TD class="ta_bg" noWrap width="100">标题：</TD>
						<TD class="ta_txt"><INPUT class="BigInput" id="txtSubject" type="text" maxLength="100" size="33" name="txtSubject"
								runat="server">
						</TD>
					</TR>
					<TR>
						<TD class="ta_bg" noWrap>类型：</TD>
						<TD class="ta_txt"><SELECT class="BigSelect" id="sltTypeId" name="sltTypeId" runat="server" DataValueField="TypeId"
								DataTextField="TypeName"></SELECT>
						</TD>
					</TR>
					<TR>
						<TD class="ta_bg" noWrap>发布人：</TD>
						<TD class="ta_txt"><INPUT id="UserIds" type="hidden" name="UserIds" runat="server"> <TEXTAREA class="BigStatic fl" id="UserNames" name="UserNames" rows="3" readOnly wrap="yes" cols="30" runat="server"></TEXTAREA>
						<INPUT class="bnt_Choice fl" style="width:50px; display:inline-table;" title="添加人员" onClick="user_select('UserIds','UserNames','');" type="button" value="选择" name="button"> 
						<INPUT class="bnt_Del fl" style="width:50px; display:inline-table;" title="清空人员" onClick="clear_double('UserIds','UserNames');" type="button" value="清空"
								name="button"></TD>
					</TR>
					</tr>
					<TR>
						<TD class="ta_bg" noWrap width="100">发布日期：</TD>
						<TD class="ta_txt"><INPUT class="BigInput" id="txtSendTimeMIN" type="text" maxLength="10" size="12" name="txtSendTimeMIN"
								runat="server"> <IMG style="CURSOR: hand" onClick="popUpCalendar(this,txtSendTimeMIN,'yyyy-mm-dd','');"
								src="/module/date_selector/calendar.gif" align="absMiddle" border="0"> 至&nbsp;
							<INPUT class="BigInput" id="txtSendTimeMAX" type="text" maxLength="10" size="12" name="SendTimeMAX"
								runat="server"> <IMG style="CURSOR: hand" onClick="popUpCalendar(this,txtSendTimeMAX,'yyyy-mm-dd','');"
								src="/module/date_selector/calendar.gif" align="absMiddle" border="0">
						</TD>
					</TR>
					<TR>
						<TD class="ta_bg" noWrap width="100">内容：</TD>
						<TD class="ta_txt"><INPUT class="BigInput" id="txtContent" type="text" maxLength="200" size="33" name="txtContent"
								runat="server">
						</TD>
					</TR>
					<TR>
						<TD class="ta_bg" noWrap width="100">操作：</TD>
						<TD class="ta_txt">
										<asp:RadioButtonList id="rblAction" runat="server" RepeatLayout="Flow" RepeatDirection="Horizontal" Font-Size="12px">
											<asp:ListItem Value="query" Selected="True">查询</asp:ListItem>
											<asp:ListItem Value="delete">删除</asp:ListItem>
										</asp:RadioButtonList>
						</TD>
					</TR>
					<TR align="center">
						<TD noWrap colSpan="2" class="bnt_con">
						    <table width="130" cellpadding="0" cellspacing="0" border="0" style="border:none;">
							   <tr>
							     <td align="left" style="border:none;"><INPUT class="bnt01" style="width:60px; display:inline-table;" onClick="return CheckForm();" type="submit" value="查 询"></td>
								 <td align="right" style="border:none;"><INPUT class="bnt01" style="width:60px; display:inline-table;" type="reset" value="重 填"></td>
							   </tr>
							</table>
						</TD>
					</TR>
				</TABLE>
			</asp:Panel>
			<asp:Panel id="pnlLater" runat="server" Visible="False">
				<asp:Repeater id="rptNotify" runat="server">
					<HeaderTemplate>
						<TABLE width="100%" cellSpacing="0" cellPadding="0" border="0" class="tab_pub" align="center">
						<TR class="TableHeader">
								<TD noWrap align="center">标题</TD>
								<TD noWrap align="center">类型</TD>
								<TD noWrap align="center">发送范围</TD>
								<TD noWrap align="center">发布人</TD>
								<TD noWrap align="center">创建时间</TD>
								<TD noWrap align="center">生效日期</TD>
								<TD noWrap align="center">终止日期</TD>
								<TD noWrap align="center">状态</TD>
								<TD noWrap align="center">操作</TD>
							</TR>
					</HeaderTemplate>
					<ItemTemplate>
						<tr class="TableLine1">
								<td>
									<a href="javascript:open_notify('<%#Eval("NotifyId")%>');"><span style="<%# (Convert.ToBoolean(Eval("Important").ToString()) == true) ? "font-weight: bold;color: #FF0000;" : ""%>"><%#Eval("Subject")%></span></a>
								</td>
								<td align="center" nowrap><%#Eval("TypeName")%></td>
								<td>
									<%#Eval("ToDeptNames").ToString() != string.Empty ? "<font color=#0000FF><b>部门：</b></font>" + Eval("ToDeptNames").ToString()  + "<br>": ""%>
									<%#Eval("ToPrivNames").ToString() != string.Empty ? "<font color=#0000FF><b>角色：</b></font>" + Eval("ToPrivNames").ToString() + "<br>" : ""%>
									<%#Eval( "ToUser").ToString() != string.Empty ? "<font color=#0000FF><b>人员：</b></font>" + GetUserNames(Eval( "ToUser").ToString()) : ""%>
								</td>								
								<td align="center" nowrap>
								<u title="部门：<%#Eval("DeptName")%>" style="CURSOR:hand"><%#Eval("UserName")%></u>
								</td>
								<td align="center"><%#Eval("SendTime")%></td>								
								<td nowrap align="center"><%# Eval("BeginDate") != DBNull.Value ? Convert.ToDateTime(Eval("BeginDate")).ToString("yyyy-MM-dd"):""%></td>
								<td nowrap align="center"><%# Eval("EndDate") != DBNull.Value ? Convert.ToDateTime(Eval("EndDate")).ToString("yyyy-MM-dd"):""%></td>
								<td nowrap align="center"><%#GetStatusDesc(Convert.ToInt32(Eval("Status")))%></td>
								<td nowrap>&nbsp;
									<a href="edit.aspx?notify_id=<%#Eval("NotifyId")%>&type_id=<%=ViewState["TypeId"]%>&page=<%=ViewState["CurrentPage"]%>">修改</a>
									<a href="javascript:show_reader('<%#Eval("NotifyId")%>','<%=ViewState["CurrentPage"]%>');">查阅情况</a>
									<a href="javascript:delete_notify('<%#Eval("NotifyId")%>','<%=ViewState["CurrentPage"]%>');">删除</a>
									<%#Convert.ToInt32(Eval("Status")) == 0 ? "<a href=\"manage.aspx?notify_id=" + Eval("NotifyId") + "&operation=0&type_id=" + ViewState["TypeId"].ToString() + "&page=" + ViewState["CurrentPage"].ToString() + "\">立即生效</a>" : ""%>
									<%#Convert.ToInt32(Eval("Status")) == 1 ? "<a href=\"manage.aspx?notify_id=" + Eval("NotifyId") + "&operation=1&type_id=" + ViewState["TypeId"].ToString() + "&page=" + ViewState["CurrentPage"].ToString() + "\">终止</a>" : ""%>
									<%#Convert.ToInt32(Eval("Status")) == 2 ? "<a href=\"manage.aspx?notify_id=" + Eval("NotifyId") + "&operation=2&type_id=" + ViewState["TypeId"].ToString() + "&page=" + ViewState["CurrentPage"].ToString() + "\">生效</a>" : ""%>
									<%#Convert.ToBoolean(Eval("Important")) == true ? "<a href=\"javascript:no_important('" + Eval("NotifyId") + "','" + ViewState["CurrentPage"].ToString() + "')\">取消置顶</a>" : ""%>
								</td>
							</tr>
					</ItemTemplate>
					<AlternatingItemTemplate>
						<tr class="TableLine2">
								<td>
									<a href="javascript:open_notify('<%#Eval("NotifyId")%>');"><span style="<%# (Convert.ToBoolean(Eval("Important").ToString()) == true) ? "font-weight: bold;color: #FF0000;" : ""%>"><%#Eval("Subject")%></span></a>
								</td>
								<td align="center" nowrap><%#Eval("TypeName")%></td>
								<td>
									<%#Eval("ToDeptNames").ToString() != string.Empty ? "<font color=#0000FF><b>部门：</b></font>" + Eval("ToDeptNames").ToString()  + "<br>": ""%>
									<%#Eval("ToPrivNames").ToString() != string.Empty ? "<font color=#0000FF><b>角色：</b></font>" + Eval("ToPrivNames").ToString() + "<br>" : ""%>
									<%#Eval( "ToUser").ToString() != string.Empty ? "<font color=#0000FF><b>人员：</b></font>" + GetUserNames(Eval( "ToUser").ToString()) : ""%>
								</td>
								
								<td align="center" nowrap>
								<u title="部门：<%#Eval("DeptName")%>" style="CURSOR:hand"><%#Eval("UserName")%></u>
								</td>
								<td align="center"><%#Eval("SendTime")%></td>								
								<td nowrap align="center"><%# Eval("BeginDate") != DBNull.Value ? Convert.ToDateTime(Eval("BeginDate")).ToString("yyyy-MM-dd"):""%></td>
								<td nowrap align="center"><%# Eval("EndDate") != DBNull.Value ? Convert.ToDateTime(Eval("EndDate")).ToString("yyyy-MM-dd"):""%></td>
								<td nowrap align="center"><%#GetStatusDesc(Convert.ToInt32(Eval("Status")))%></td>
								<td nowrap>&nbsp;
									<a href="edit.aspx?notify_id=<%#Eval("NotifyId")%>&type_id=<%=ViewState["TypeId"]%>&page=<%=ViewState["CurrentPage"]%>">修改</a>
									<a href="javascript:show_reader('<%#Eval("NotifyId")%>','<%=ViewState["CurrentPage"]%>');">查阅情况</a>
									<a href="javascript:delete_notify('<%#Eval("NotifyId")%>','<%=ViewState["CurrentPage"]%>');">删除</a>
									<%#Convert.ToInt32(Eval("Status")) == 0 ? "<a href=\"manage.aspx?notify_id=" + Eval("NotifyId") + "&operation=0&type_id=" + ViewState["TypeId"].ToString() + "&page=" + ViewState["CurrentPage"].ToString() + "\">立即生效</a>" : ""%>
									<%#Convert.ToInt32(Eval("Status")) == 1 ? "<a href=\"manage.aspx?notify_id=" + Eval("NotifyId") + "&operation=1&type_id=" + ViewState["TypeId"].ToString() + "&page=" + ViewState["CurrentPage"].ToString() + "\">终止</a>" : ""%>
									<%#Convert.ToInt32(Eval("Status")) == 2 ? "<a href=\"manage.aspx?notify_id=" + Eval("NotifyId") + "&operation=2&type_id=" + ViewState["TypeId"].ToString() + "&page=" + ViewState["CurrentPage"].ToString() + "\">生效</a>" : ""%>
									<%#Convert.ToBoolean(Eval("Important")) == true ? "<a href=\"javascript:no_important('" + Eval("NotifyId") + "','" + ViewState["CurrentPage"].ToString() + "')\">取消置顶</a>" : ""%>
								</td>
							</tr>
					</AlternatingItemTemplate>
					<FooterTemplate>
						</TABLE>
					</FooterTemplate>
				</asp:Repeater>
				<asp:Literal id="litMessage" runat="server"></asp:Literal>
				<BR>
				<CENTER><INPUT class="BigButton" onClick="history.back();" type="button" value="返回"></CENTER>
				<BR>
			</asp:Panel>
            </div>
		</form>
	</body>
</HTML>
